import ftRequest from '..'

import { IAccount, IDataType, IResponse, ILoginResult } from './type'

enum LoginAPI {
  AccountLogin = '/user/backendLogin',
  ListRoleMenu = '/menu/listRoleMenu'
}

export function accountLoginRequest(account: IAccount) {
  return ftRequest.post<IDataType<IResponse<ILoginResult>>>({
    url: LoginAPI.AccountLogin,
    data: account,
    showLoading: false
  })
}

export function listRoleMenu(roleId: number) {
  return ftRequest.get<IDataType<IResponse<ILoginResult>>>({
    url: LoginAPI.ListRoleMenu + '/' + roleId,
    showLoading: false
  })
}
